// 统一的溯源数据类型定义
export interface TraceRecord {
  // 基础信息
  id: string
  productId: string
  batchNo: string
  
  // 环节信息
  processType: 'planting' | 'growing' | 'harvest' | 'processing' | 'transport' | 'storage' | 'delivery'
  processName: string
  
  // 时间信息
  processTime: string
  inspectTime?: string
  
  // 人员信息
  operator: string
  inspector?: string
  
  // 位置信息
  location: string
  position?: [number, number] // 经纬度坐标
  
  // 环境数据
  temperature?: string
  humidity?: string
  
  // 质量信息
  status: 'qualified' | 'unqualified' | 'pending'
  quality?: string
  certificate?: string
  
  // 描述信息
  description?: string
  
  // 媒体信息
  images?: string[]
  
  // 区块链信息
  blockchainHash?: string
  blockHeight?: number
}

// 环节类型映射
export const processTypeMap = {
  planting: '种植',
  growing: '培育',
  harvest: '采收',
  processing: '加工',
  transport: '运输',
  storage: '仓储',
  delivery: '配送'
} as const

// 状态映射
export const statusMap = {
  qualified: '合格',
  unqualified: '不合格',
  pending: '待检'
} as const

// 状态标签映射
export const statusTagMap = {
  qualified: 'success',
  unqualified: 'danger',
  pending: 'warning'
} as const

// 环节图标映射
export const processIcons = {
  planting: '🌱',
  growing: '🌿',
  harvest: '🌾',
  processing: '⚙️',
  transport: '🚛',
  storage: '🏭',
  delivery: '🚚'
} as const

// 环节选项
export const processOptions = [
  { value: 'planting', label: '种植' },
  { value: 'growing', label: '培育' },
  { value: 'harvest', label: '采收' },
  { value: 'processing', label: '加工' },
  { value: 'transport', label: '运输' },
  { value: 'storage', label: '仓储' },
  { value: 'delivery', label: '配送' }
] as const 